<?php
/**
 * CreateTime: 2023/12/19 14:28
 * User:LinQ
 */

namespace App\Console\Commands;

use App\Func\Office\WordFunc;
use App\Jobs\LetterFileJob;
use App\Jobs\TestJob;
use App\Models\System\JobsModel;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Storage;
use Symfony\Component\Uid\UuidV4;


class SendLetterCommand extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'sendLetter';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Command description';

    /**
     * Create a new command instance.
     *
     * @return void
     */
    public function __construct()
    {
        parent::__construct();
    }

    /**
     * Execute the console command.
     * 这个方法中的逻辑需要自己写
     * @return mixed
     */
    public function handle()
    {
        $uid1 = (\Symfony\Component\Uid\UuidV4::v6()->toRfc4122());
        dd((new \App\Func\Jobs\JobsDockerFunc())->calculateSum());
        for ($i = 0; $i <= 4; $i++) {
            $index = $i;
            echo "队列".$i."开始\n";
            (new \App\Func\Jobs\JobsDockerFunc())->pushJobs(new LetterFileJob(
                public_path() . '/xx.docx',
                [
                    [
                        'search' => 'zlh',
                        'type' => 2,
                        'replace' => [
                            'path' =>  public_path() . '/aaa.png',
                            'width' => 50,
                            'height' => 50
                        ],
                    ],
                    [
                        'search' => 'zlhxxxxx',
                        'type' => 1,
                        'replace' => $uid1,
                    ]
                ],
                $uid1,
                "letters/cc/group1",
                "/letters/cc/group1/pdf",
                public_path() . '/img1.png',
                "/letters/cc/images/".$uid1,
                1
            ),'u1',json_encode(
                [
                    'describe' => '用于测试'
                ]
            ),$uid1);
            echo "队列".$i."结束\n";
        }
        die();
    }
}